<template>
  <el-container style="min-height: 100vh;">
    <el-aside :width="sideWidth + 'px'" style="background-color: rgb(238, 241, 246); box-shadow: 2px 0 6px rgb(0 21 41 / 35%);">
      <Aside :isCollapse="isCollapse"/>
    </el-aside>
    <el-container>
      <el-header style="border-bottom: 1px solid #ccc;">
        <Header :collapseBtnClass="collapseBtnClass" :collapse="collapse" :user="user"/>
      </el-header>
      <el-main>
        <router-view/>
      </el-main>
    </el-container>
  </el-container>

</template>

<script>

import Aside from "@/components/Aside";
import Header from "@/components/Header";

export default {
  name: 'Manage',
  data() {
    return {
      collapseBtnClass: 'el-icon-s-fold', // 侧边栏收缩按钮
      isCollapse: false,    // 侧边栏状态是否收缩 false 不 收缩
      sideWidth: 200,       // 侧边栏宽度 不收缩时 200px 收缩时64px
      user: {},
    }
  },
  created() {

  },
  components: {
    Header,
    Aside
  },
  methods: {
    collapse() {    // 点击收缩按钮触发
      this.isCollapse = !this.isCollapse;
      if (this.isCollapse) {    // 收缩
        this.sideWidth = 64;
        this.collapseBtnClass = 'el-icon-s-unfold';
      } else {                  // 展开
        this.sideWidth = 200;
        this.collapseBtnClass = 'el-icon-s-fold';
      }
    },
  }
}
</script>

